package cn.com.nou.base.dao.bdm;

import cn.com.nou.common.entity.NouEnumerationT;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface LevelMapper {
    List<NouEnumerationT> getLevelList(NouEnumerationT nouEnumerationT, int offset, int limit);

    @Select("select count(*) from nou_enumeration_t where type=#{type}")
    int getLevelCount(String type);

    @Select("select * from nou_enumeration_t where itemCode=#{itemCode} or itemName=#{itemName}")
    List<NouEnumerationT> getSameLevelItemCodeOrItemName(NouEnumerationT nouEnumerationT);

    int addLevel(NouEnumerationT nouEnumerationT);

    @Update("UPDATE `gC539F2_db`.`nou_enumeration_t` set status = '0' where id = #{id}")
    int deleteLevel(String id);

    @Select("SELECT count(*) from nou_student_info_t where nou_student_info_t.educationType=#{id}")
    int getStudentUsedCount(NouEnumerationT nouEnumerationT);

    int updateLevel(NouEnumerationT nouEnumerationT);

    @Select("SELECT count(*) from nou_collage_enumeration_t where nou_collage_enumeration_t.enumberId=#{id}")
    int getScholUsedCount(NouEnumerationT nouEnumerationT);

    @Select("SELECT count(*) from nou_spec_info_t where nou_spec_info_t.educationLevel=#{id}")
    int getSpecUsedCount(NouEnumerationT nouEnumerationT);
}